JavaScript

{grid.object}ajaxCallback Method

Syntax

{grid.Object}.ajaxCallback(part,rowNum,XbasicFunction [,callbackURL [,additionalData [, options]]])

Arguments

partstring

'G', 'S', 'D' - indicates the Grid part (Search, Grid, or Detail View) from which data should be submitted.

rowNumstring

Specifies the Grid row from which data should be submitted.

XbasicFunctionstring

the name of the Xbasic function that will handle the callback.

callbackURLstring

this parameter is almost always set to a blank string. It can be used to specify the URL you want to call to handle the callback. For example, you could call a .php, or .asp page to handle the callback. If this value is not blank then the setting for XbasicFunction is ignored.

additionalDatastring

A Javascript string of name/value pairs, separated by '&', of additional data you want to submit to the server. For example 'data1=value1&data2=value2'

optionsobject

An object with one or more additional options. Available options include:

ajaxCallbackTimeoutnumber

The length of time in milliseconds to wait until the callback times out.

onCompletefunction

A function that will be called when the operation completes.

errorFunctionfunction

Function called if the server does not send a response. A response may not be sent if there is no internet connection or the server cannot be reached.

If the server does not send a response because there was an error when executing the Xbasic function handling the callback, the error function will not be called. To handle Xbasic errors in your callback functions, add error handling logic to capture the Xbasic error and return an error message to the client.

deviceOfflineFunctionfunction

A function that will be called if the device is offline and the callback cannot be performed.

Description

Does an Ajax callback to a server.

Example

{grid.object}.ajaxCallback('G','2','myCallback1','','arg1=value1&arg2=value2');

Data from the current row is submitted to the server. It is recommended that you use Action Javascript to write the code for you. This can be done by creating an Ajax Callback Action either as a Javascript Action or as Action Javascript for a control's event.

See Also